<div id="item_youzan_pager" class="jqpager" style="margin-bottom: 1px;"></div>		
<div style="display: inline-table; width: auto; margin-bottom:5px">
  #if(shop??)
  <span>店铺名称：#(shop.shop_name??)</span>
  <input type="hidden" id="shopId" value="#(shop.id??)" />
  #end
</div>
<table class="table table-striped table-bordered" id="mainWechatMediaTable" style="padding-top: 5px;" border="0">
	<thead>
		<tr>
			<th><span style="vertical-align: middle;">&nbsp;&nbsp;卡券名称</span></th>
			<th><span style="vertical-align: middle;">&nbsp;&nbsp;状态</span></th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody class="productCardGrid"></tbody>
</table>
<!-- html 模板文件 -->
<script type="text/template" id="productCard_table_tr_tpl">
{{each list as item i}}
		<tr class="package" id="tr_id_{{i}}"  card-id="{{item.id}}" card-name="{{item.title}}">
			<td>{{item.title}}</td>
			<td>
				<span class="label {{if item.status=="已失效"}} label-default {{else}} label-success {{/if}}">
					{{item.status}}
				</span>
			</td>
			<td><a onclick="cardItem(this)"  class="btn btn-success">选择</a></td>
		</tr>
{{/each}}
</script>
<script type="text/template" id="table_noresult_tr_tpl">
	<tr class="package"><td class="center" colspan="5">没有数据</td></tr>
</script>
<script type="text/template" id="option_tpl_url">
	<option value="{{id}}">{{shopName}}</option>
</script>
<script type="text/javascript">

$(function(){
	$(".productCardGrid").html($("#table_noresult_tr_tpl").html());
	var params = {};
	params.shopId = $("#shopId").val();
	
	if(params.shopId == null || params.shopId == ""){
		return;
	}
	
	var table = new obz.TableView("item_youzan_pager", "#(webctx)/product/youzan/cardList", params, function(resp){
		if(resp && resp.list && resp.list.length>0){
			$('.productCardGrid').html(template('productCard_table_tr_tpl', resp));
			TBatch.tableId = "mainProductTable";
			//初始化checkbox点击事件
			TBatch.checkCheckbox();
			TBatch.initCheckboxClick();
		}
	}); 
	table.init();
})

</script>